home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_sol_ctrllever2.cog < prev    next >
Text File  |  1999-11-15  |  8KB  |  325 lines

  1. # Jones 3D Cog Script
  2. #
  3. # SOL_CtrlLever2.cog
  4. #
  5. # Sets up lever2 in the "pulled" possition (ready for pushing) at level start.
  6. #
  7. # [TRM]
  8. #
  9. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.     
  14.     message     startup
  15.     message     user0
  16.     message     activated
  17.    
  18.     thing       player          local
  19.     thing       leverGhost      # Lever position
  20.     thing       indy            # Actor Indy
  21.     thing       trkSwitch       # Track switch
  22.     thing       panelTarget     # focus for control panel
  23.     
  24.     thing       switchCam       # Switch cam
  25.     thing       ctrlCam1        # Control panel cam
  26.     
  27.     thing       pushed          local
  28.     thing       pulled          local
  29.     
  30.     thing       offsetCam
  31.     
  32.     surface     switch          # Switch texture
  33.     
  34.     # track switches    
  35.     surface     switchA
  36.     surface     switchB
  37.     
  38.     template    tplLevPull=pullever          local
  39.     template    tplLevPush=pushlever         local
  40.     
  41.     keyframe    leverPull=gen_lever_pull.key        local
  42.     keyframe    leverPush=gen_lever_push.key        local
  43.     
  44.     keyframe    indyPull=in_pull_lever.key          local
  45.     keyframe    indyPush=in_push_lever.key          local
  46.     
  47.     sound       sndLever=gen_lever_pull.wav                 local
  48.     sound       sndSwitchTex=sol_panel_switch_c.wav         local
  49.     sound       inJuice=Sl02j04.wav                         local
  50.     
  51.     cog         hintCog
  52.     
  53.     int         powerOn=0       local
  54.     int         ready=1         local
  55.     int         playing=0       local
  56.     int         curCam          local
  57.     int         sound2          local
  58.     
  59.     # ** subroutines **
  60.     flex        pullLever       local
  61.     flex        pushLever       local
  62.     flex        noPower         local
  63.     
  64. end
  65.  
  66. # ========================================================================================
  67.  
  68. code
  69.  
  70. startup:
  71.  
  72.     pulled = CreateThing(tplLevPush, leverGhost);
  73.     CaptureThing(pulled);
  74.     
  75.     # Mine Track -- Go Straight
  76.     SetSurfaceFlags(switchA, 0x4000);
  77.     ClearSurfaceFlags(switchB, 0x4000);
  78.     
  79.     return;
  80.  
  81. # ========================================================================================
  82.  
  83. user0:
  84.  
  85.     powerOn = 1;
  86.     return;
  87.  
  88. # ========================================================================================
  89.  
  90. activated:
  91.  
  92.     Print("activated: ctrlLever2");
  93.     
  94.     player = GetLocalPlayerThing();
  95.     curCam = GetCurrentCamera();
  96.     
  97.     # no power
  98.     if((GetSenderRef() == pulled) && (IsGhostVisible(player, pulled, 50.0)) && (!powerOn) && (!playing))
  99.     {
  100.         playing = 1;
  101.         Call noPower;
  102.     }
  103.         
  104.     # push lever
  105.     else if((GetSenderRef() == pulled) && (IsGhostVisible(player, pulled, 50.0)) && (powerOn) && (ready))
  106.     {
  107.         ready = 0;
  108.         Call pushLever;
  109.     }
  110.         
  111.     # pull lever
  112.     else if((GetSenderRef() == pushed) && (IsGhostVisible(player, pushed, 50.0)) && (powerOn) && (ready))
  113.     {
  114.         ready = 0;
  115.         Call pullLever;
  116.     }
  117.         
  118.     return;
  119.         
  120. # ========================================================================================
  121.  
  122. pushLever:
  123.  
  124.     # do cutscene stuff
  125.     MakeMeStop();
  126.     StartCutscene(2);
  127.     
  128.     # switch to offsetCam
  129.     SetCameraFocus(2, offsetCam);
  130.     SetCameraSecondaryFocus(2, player);
  131.     SetCurrentCamera(2);
  132.     SetCameraFOV(90, 0, 0.0);
  133.     
  134.     # put away any weapon
  135.     DeselectWeaponWait(player);
  136.     
  137.     # outfit Indy actor
  138.     CopyPlayerHolsters(player, indy);
  139.     
  140.     # show actor hide player
  141.     SetThingFlags(player, 0x80000);
  142.     ClearThingFlags(indy, 0x80000);
  143.     
  144.     # push the lever
  145.     PlayKey(pulled, leverPush, 4, 0x14, 0);
  146.     PlayKey(indy, indyPush, 4, 0x12, 0);
  147.     Sleep(0.75);
  148.     PlaySoundLocal(sndLever, 1.0, 0.0, 0x0, 1);
  149.     
  150.     # Cut to Control Panel cam
  151.     SetCameraFocus(2, ctrlCam1);
  152.     SetCameraSecondaryFocus(2, panelTarget);
  153.     SetCurrentCamera(2);
  154.     SetCameraFOV(90, 0, 0.0);
  155.     Sleep(0.5);
  156.     
  157.     # flip panel switch texture
  158.     SetWallCel(switch, 2);
  159.     sound2 = PlaySoundLocal(sndSwitchTex, 1.0, 0.0, 0x0, 0);
  160.     WaitForSound(sound2);
  161.     Sleep(0.5);
  162.     
  163.     # Cut to switch cam
  164.     SetCameraFocus(2, switchCam);
  165.     SetCameraSecondaryFocus(2, trkSwitch);
  166.     SetCurrentCamera(2);
  167.     SetCameraFOV(90, 0, 0.0);
  168.     
  169.     # rotate track switch
  170.     Rotate(trkSwitch, 90, 1, 1.0);
  171.     Sleep(2.0);
  172.     
  173.     # hide indy show player
  174.     SetThingFlags(indy, 0x80000);
  175.     ClearThingFlags(player, 0x80000);
  176.     
  177.     # stop any unfinished animations
  178.     ResetThing(indy);
  179.     
  180.     # restore controls
  181.     ClearActorFlags(player, 0x200000);
  182.     
  183.     # restore camera
  184.     SetCurrentCamera(curCam);
  185.     
  186.     # Destroy old lever and create a new one
  187.     DestroyThing(pulled);
  188.     pushed = CreateThing(tplLevPull, leverGhost);
  189.     CaptureThing(pushed);
  190.     
  191.     # Mine Track -- turn off
  192.     SetSurfaceFlags(switchB, 0x4000);
  193.     ClearSurfaceFlags(switchA, 0x4000);
  194.     
  195.     EndCutscene();
  196.     ready = 1;
  197.     
  198.     # tell hintCog to check switch positions
  199.     SendMessage(hintCog, user1);
  200.     
  201.     return;
  202.     
  203. # ========================================================================================
  204.  
  205. pullLever:
  206.  
  207.     # do cutscene stuff
  208.     MakeMeStop();
  209.     StartCutscene(2);
  210.     
  211.     # switch to offsetCam
  212.     SetCameraFocus(2, offsetCam);
  213.     SetCameraSecondaryFocus(2, player);
  214.     SetCurrentCamera(2);
  215.     SetCameraFOV(90, 0, 0.0);
  216.     
  217.     # put away any weapon
  218.     DeselectWeaponWait(player);
  219.     
  220.     # outfit Indy actor
  221.     CopyPlayerHolsters(player, indy);
  222.     
  223.     # show actor hide player
  224.     SetThingFlags(player, 0x80000);
  225.     ClearThingFlags(indy, 0x80000);
  226.     
  227.     # pull the lever
  228.     PlayKey(pushed, leverPull, 4, 0x14, 0);
  229.     PlayKey(indy, indyPull, 4, 0x12, 0);
  230.     Sleep(0.85);
  231.     PlaySoundLocal(sndLever, 1.0, 0.0, 0x0, 1);
  232.     
  233.     # Cut to Control Panel cam
  234.     SetCameraFocus(2, ctrlCam1);
  235.     SetCameraSecondaryFocus(2, panelTarget);
  236.     SetCurrentCamera(2);
  237.     SetCameraFOV(90, 0, 0.0);
  238.     Sleep(0.5);
  239.     
  240.     # flip panel switch texture
  241.     SetWallCel(switch, 1);
  242.     sound2 = PlaySoundLocal(sndSwitchTex, 1.0, 0.0, 0x0, 0);
  243.     WaitForSound(sound2);
  244.     Sleep(0.5);
  245.     
  246.     # Cut to switch cam
  247.     SetCameraFocus(2, switchCam);
  248.     SetCameraSecondaryFocus(2, trkSwitch);
  249.     SetCurrentCamera(2);
  250.     
  251.     # rotate track switch
  252.     SetCameraFOV(90, 0, 0.0);
  253.     Rotate(trkSwitch, -90, 1, 1.0);
  254.     Sleep(2.0);
  255.     
  256.     # hide indy show player
  257.     SetThingFlags(indy, 0x80000);
  258.     ClearThingFlags(player, 0x80000);
  259.     
  260.     # stop any unfinished animations
  261.     ResetThing(indy);
  262.     
  263.     # restore controls
  264.     ClearActorFlags(player, 0x200000);
  265.     
  266.     # restore camera
  267.     SetCurrentCamera(curCam);
  268.     
  269.     # Destroy old lever and create a new one
  270.     DestroyThing(pushed);
  271.     pulled = CreateThing(tplLevPush, leverGhost);
  272.     CaptureThing(pulled);
  273.     
  274.     # Mine Track -- Go Straight
  275.     SetSurfaceFlags(switchA, 0x4000);
  276.     ClearSurfaceFlags(switchB, 0x4000);
  277.     
  278.     EndCutscene();
  279.     ready = 1;
  280.     
  281.     # tell hintCog to check switch positions
  282.     SendMessage(hintCog, user1);
  283.     
  284.     return;
  285.  
  286. # ========================================================================================
  287.  
  288. noPower:
  289.  
  290.     # do cutscene stuff
  291.     MakeMeStop();
  292.     StartCutscene(2);
  293.     
  294.     # switch to offsetCam
  295.     SetCameraFocus(2, offsetCam);
  296.     SetCameraSecondaryFocus(2, player);
  297.     SetCurrentCamera(2);
  298.     SetCameraFOV(90, 0, 0.0);
  299.     
  300.     # put away any weapon
  301.     DeselectWeaponWait(player);
  302.     
  303.     # activate lever
  304.     PlayMode(player, 60, 0);
  305.     Sleep(0.3);
  306.     
  307.     # say line
  308.     PlayVoice(player, inJuice, 1.0, 1);
  309.     Sleep(0.5);
  310.     
  311.     # restore controls and camera
  312.     ClearActorFlags(player, 0x200000);
  313.     SetCurrentCamera(curCam);
  314.     
  315.     EndCutscene();
  316.     
  317.     playing = 0;
  318.     
  319.     return;
  320.  
  321. # ========================================================================================
  322.  
  323. end
  324.  
  325.